﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using DataAccess.ArchivesTableAdapters;
using DataAccess;
using System.Data;

namespace BusinessLogic
{
    [DataObject]
    public class DocTypeBO
    {
        private tblDocTypeTableAdapter DocTypeAdapter = null;
        protected tblDocTypeTableAdapter Adapter
        {
            get
            {
                if (DocTypeAdapter == null)
                    DocTypeAdapter = new tblDocTypeTableAdapter();
                return DocTypeAdapter;
            }
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Select, true)]
        public Archives.tblDocTypeDataTable GetAllDocTypes()
        {
            return Adapter.GetAllDocTypes();
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Select, false)]
        public DataTable GetByID(int dtID)
        {
            return Adapter.GetByID(dtID);
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Insert, true)]
        public int AddNewDocType(string dtName, string dtCode)
        {
            return Adapter.Insert(dtName, dtCode);
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Update, true)]
        public int UpdateDocTypes(string dtName, string dtCode, int dtID)
        {
            return Adapter.Update(dtName, dtCode, dtID);
        }

        [DataObjectMethodAttribute(DataObjectMethodType.Delete, true)]
        public int DeleteDocType(int dtID)
        {
            return Adapter.Delete(dtID);
        }
    }
}
